{{ template "head" .Global}}

<!--DataTables example-->
<div id="striped-table">
    <h4 class="header">用户列表 <a href="#add"
                               class="btn dropdown-button waves-effect waves-light modal-trigger"
                               style="float:right">添加</a>
    </h4>
    <div class="row">
        <div class="col s12 m12 l12">
            <table  class="responsive-table display" id="data-table-simple">
                <thead>
                <tr>
                    <th>ID</th>
                    <th>分组名</th>
                    <th>标签</th>
                    <th>操作</th>
                    <th>删除</th>
                </tr>
                </thead>
                <tbody>
                {{ range $k,$v :=$.LdapGroupAll}}
                <tr>
                    <td>{{$v.gidNumber}}</td>
                    <td>{{$v.description}}</td>
                    <td>{{$v.cn}}</td>
                    <td>
                        <a href="#edit" class="btn dropdown-button waves-effect waves-light modal-trigger"
                           onclick="ldap_group_edit({{$v.cn}},{{$v.description}})">编辑</a>
                    </td>
                    <td onclick="ldap_group_del(this,{{$v.cn}})">
                        <a a href="#" class="btn dropdown-button waves-effect waves-light ">删除</a>
                    </td>
                </tr>
                {{ end }}
                </tbody>
            </table>
        </div>
    </div>
</div>
<br>


</div>
</div>
<!--end container-->

</section>
<!-- END CONTENT -->

<div id="add" class="modal">
    <form role="form">
        <div class="modal-content">
            <div class="row">
                <p>
                    <strong>添加分组</strong>
                </p>
            </div>
            <div class="row">

                <div class="input-field col s6">
                    <input type="text" name="cn" id="cn">
                    <label for="cn">标签(CN)</label>
                </div>
                <div class="input-field col s6">
                    <input type="text" name="description" id="description">
                    <label for="description">分组名</label>
                </div>

            </div>

        </div>

        <div class="modal-footer">
            <a class="waves-effect waves-red btn-flat modal-action modal-close">关闭</a>
            <a class="waves-effect waves-green btn-flat modal-action" onclick="ldap_add_group()">
                保存
            </a>
        </div>
    </form>
</div>

<div id="edit" class="modal">
    <form role="form">
        <div class="modal-content">
            <div class="row">
                <p>
                    <strong>编辑分组</strong>
                </p>
            </div>
            <div class="row">
                <div class="input-field col s6">
                    <input disabled type="text" name="edit_cn" id="edit_cn" value=" ">
                    <label for="edit_cn" class="active">标签(CN)禁止修改</label>
                </div>
                <div class="input-field col s6">
                    <input type="text" name="edit_description" id="edit_description" value=" ">
                    <label class="active" for="edit_description">分组名</label>
                </div>
            </div>
        </div>

        <div class="modal-footer">
            <a class="waves-effect waves-red btn-flat modal-action modal-close">关闭</a>
            <a class="waves-effect waves-green btn-flat modal-action" onclick="ldap_group_edit_post()"
                    style="float:right">修改</a>
        </div>

    </form>
</div>

{{ template "foot" .Global}}
<script type="text/javascript" src="/statics/js/function.js"></script>
<!-- jQuery Library -->
<script type="text/javascript" src="/statics/js/plugins/jquery-1.11.2.min.js"></script>
<!--materialize js-->
<script type="text/javascript" src="/statics/js/materialize.min.js"></script>
<!--prism-->
<script type="text/javascript" src="/statics/js/plugins/prism/prism.js"></script>
<!--scrollbar-->
<script type="text/javascript" src="/statics/js/plugins/perfect-scrollbar/perfect-scrollbar.min.js"></script>
<!-- data-tables -->
<script type="text/javascript" src="/statics/js/plugins/data-tables/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="/statics/js/plugins/data-tables/data-tables-script.js"></script>
<!-- chartist -->
<script type="text/javascript" src="/statics/js/plugins/chartist-js/chartist.min.js"></script>
<!--sweetalert -->
<script type="text/javascript" src="/statics/js/plugins/sweetalert/sweetalert.min.js"></script>
<!--plugins.js - Some Specific JS codes for Plugin Settings-->
<script type="text/javascript" src="/statics/js/plugins.min.js"></script>
<!--custom-script.js - Add your own theme custom JS-->
<script type="text/javascript" src="/statics/js/custom-script.js"></script>

<script src="/statics/js/layer.js"></script>
<script type="text/javascript">
    /*Show entries on click hide*/
    $(document).ready(function () {
        $(".dropdown-content.select-dropdown li").on("click", function () {
            var that = this;
            setTimeout(function () {
                if ($(that).parent().hasClass('active')) {
                    $(that).parent().removeClass('active');
                    $(that).parent().hide();
                }
            }, 100);
        });
    });
</script>
</body>

</html>